#include "EbnCondition.h"
#include "EbnWorldState.h"

CEbnCondition::CEbnCondition(CEbnWorldState * worldState, bool positiveCondition) :
    CEbnProposition(worldState, positiveCondition)
{

}

CEbnCondition::~CEbnCondition(void)
{
    // TODO: clean all the nest links
}

bool CEbnCondition::hasNestLink(CEbnLink * pLink)
{
    vector<CEbnLink *>::iterator itLink;
    for (itLink = mNestLinkList.begin(); itLink != mNestLinkList.end(); itLink++)
    {
        if ((*itLink) == pLink)
        {
                return true;
        }
    }

    return false;
}

void CEbnCondition::addNestLink(CEbnLink * pLink)
{
    bool exist = hasNestLink(pLink);

    if (exist == false)
    {
            mNestLinkList.push_back(pLink);
    }
}

CEbnProposition * CEbnCondition::getProposition()
{
    return (CEbnProposition*) this;
}
